import paramiko

#获取Transport实例
transport = paramiko.Transport("192.168.2.198", 22)
#连接SSH服务端
transport.connect(username='liuqi', password='123')
#获取SFTP实例
sftp = paramiko.SFTPClient.from_transport(transport)
#设置上传的本地/远程文件路径
sftp.put('/tmp/location.py', '/tmp/test.py')

sftp.get('remove_path', 'local_path')

transport.close()